<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var timer;
			window.onload=function(){
				showTime();
				timer=window.setInterval("showTime()",1000);
			}
			function showTime(){
				var d=new Date();
				//alert(d.getMonth());
				document.querySelector("p").innerHTML=d.toLocaleString();
			}
			function getTime(){
				alert(document.querySelector("[name=D3]").value);
				alert(document.querySelector("[name=D2]").value);
				alert(document.querySelector("[name=D1]").value);
			}
			function stopTime(){
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body>
		<p></p>
		<input type="datetime-local" name="D3" pattern="yyyy-MM-dd hh:mm"/>
		<input type="date" name="D2" pattern="yyyy-MM-dd"/>
		<input type="time" name="D1"/>
		<input type="button" value="获得事件格式" onclick="getTime()"/>
		
		<input type="button" value="停止时间" onclick="stopTime()"/>
	</body>
</html>